import request from '@/utils/axios/index'
import type { Dayjs } from 'dayjs'

/** 拓展目标_客户信息 */
export interface ExpandTargetCustomer {
  id: number // ID
  customerName: string // 客户名称
  enterpriseType: string // 企业类型
  bussinessResource: string // 业务来源
  contactName: string // 联系人
  contactNumber: string // 联系电话
  location: string // 所在地区
  address: string // 详细地址
  ownerUserId: number // 拓展所属人id
}

// 拓展目标_客户 API
export const ExpandTargetCustomerApi = {
  // 查询拓展目标_客户分页
  getExpandTargetCustomerPage: async (params: any) => {
    return await request.get({ url: `/san/biz-expand-target-customer/page`, params })
  },
  // 查询拓展目标_年份统计
  getExpandTargetCustomerYear: async (params: any) => {
    return await request.get({ url: `/san/biz-expand-target-customer/year`, params })
  },

  // 查询拓展目标_客户详情
  getExpandTargetCustomer: async (id: number) => {
    return await request.get({ url: `/san/biz-expand-target-customer/get?id=` + id })
  },

  // 新增拓展目标_客户
  createExpandTargetCustomer: async (data: ExpandTargetCustomer) => {
    return await request.post({ url: `/san/biz-expand-target-customer/create`, data })
  },

  // 修改拓展目标_客户
  updateExpandTargetCustomer: async (data: ExpandTargetCustomer) => {
    return await request.put({ url: `/san/biz-expand-target-customer/update`, data })
  },

  // 删除拓展目标_客户
  deleteExpandTargetCustomer: async (id: number) => {
    return await request.delete({ url: `/san/biz-expand-target-customer/delete?id=` + id })
  },

  /** 批量删除拓展目标_客户 */
  deleteExpandTargetCustomerList: async (ids: number[]) => {
    return await request.delete({
      url: `/san/biz-expand-target-customer/delete-list?ids=${ids.join(',')}`
    })
  },

  // 导出拓展目标_客户 Excel
  exportExpandTargetCustomer: async (params) => {
    return await request.download({ url: `/san/biz-expand-target-customer/export-excel`, params })
  },
  checkExistByName: async (name: string) => {
    return await request.get({
      url: `/san/biz-expand-target-customer/checkExistByName?name=` + name
    })
  }
}
